package durst.exception;

import java.io.StringReader;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.StreamingResolution;
import net.sourceforge.stripes.exception.DefaultExceptionHandler;

public class CalendarExceptionHandler extends DefaultExceptionHandler {
	public Resolution handleAccessDenied(AccessDeniedException exc,
			HttpServletRequest request, HttpServletResponse response) {
		return (exc.jsonRequest ? new StreamingResolution(
				"text/javascript",
				new StringReader("window.location=" + exc.prefix + "/login.jsp"))
				: new ForwardResolution("/access_denied.jsp"));
	}
}
